package com.atguigu.ssyx.mq.service;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author ZhangYK
 * @version 8.0
 * @title RabbitService
 * @description
 * @create 2024/7/8 14:56
 */
@Service
public class RabbitService {
    @Resource
    private RabbitTemplate rabbitTemplate;

    //发送消息
    //exchange,交换机
    // routingKey,路由
    // message消息
    public Boolean sendMassage(String exchange, String routingKey, Object message){
        rabbitTemplate.convertAndSend(exchange, routingKey, message);
        return true;
    }
}
